<template>
	<view class="hui">
		<view class="head">
			<u-navbar :safeAreaInsetTop="true" :placeholder="true" bgColor="transparent">
				<view class="u-nav-slot b_flex_c" slot="left">
					<u-icon color="#000000" name="map" size="20" v-if="user.fc"></u-icon>
					<view v-else></view>
					<view class="city" v-if="user.fc"><text v-if="user.fc.name">{{user.fc.name}}</text> </view>
				</view>
			</u-navbar>
		</view>

		<view class="lun_box"></view>

		<view class="icon_box" v-for="(item,index) in icon" :key="index">
			<view class="name">
				{{item.name}}
			</view>
			<view class="b_flex_c_w img_box">
				<view @click="setUrl(items)" class="info_box" v-for="(items,indexs) in item.list" :key="indexs">
					<image class="img" :src="items.image"></image>
					<view>{{items.name}}</view>
				</view>
			</view>
		</view>


	</view>
</template>

<script>
import {
		userInfo,glWork
	} from '@/require/api';
	export default {
		data() {
			return {
				user: '',
				icon: []
			}
		},
		onLoad() {
			this.getLm();
			this.getUserInfo();
		},
		methods: {
			async getLm(){
			  let {code,data}=await glWork();
				  if(code==1){
					  this.icon=data;
				  }
			},
			setUrl(e){
			   if(e.url){
				   this.$project.toPath(e.url+'?title='+e.name);
			   }	
			},
			async getUserInfo() {
				let {
					data,
					code
				} = await userInfo();
				if (code == 1) {
					this.user = data;
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	::v-deep {
		.u-navbar--fixed {
			background: linear-gradient(to bottom, #B9DDFF, #D7EAF3);
		}
	}

	.head {
		background: linear-gradient(to bottom, #B9DDFF, #D7EAF3);
	}

	.city {
		margin-left: 10rpx;
		color: black;
	}

	.lun_box {
		width: 100%;
		height: 140rpx;
		background: linear-gradient(to bottom, #D7EAF3, #F5F5F5);
	}

	.icon_box {
		box-sizing: border-box;
		padding: 0 25rpx;
		position: relative;
		top: -120rpx;
	}

	.name {
		font-size: 30rpx;
		margin-bottom: 25rpx;
	}

	.img {
		width: 80rpx;
		height: 80rpx;
		border-radius:15rpx;
	}

	.img_box {
		background-color: white;
		border-radius: 15rpx;
		box-sizing: border-box;
		padding: 0rpx 0 20rpx 0;
		font-size: 29rpx;
		margin-bottom: 25rpx;
	}

	.info_box {
		text-align: center;
		width: 25%;
		margin-top: 20rpx;
	}
</style>